<?php
declare (strict_types=1);

namespace magein\sms\service\think;

use magein\sms\Sms;
use think\Service;

class SmsService extends Service
{
    /**
     * 注册服务
     *
     * @return void
     */
    public function register()
    {
        $this->app->bind('sms', Sms::class);
    }

    /**
     * 执行服务
     *
     * @return void
     */
    public function boot()
    {
        $this->app->sms->setConfig(config('sms'));

        // 加载函数
        $this->loadFunc();

        // 注册路由
        $this->loadRoutesFrom(__DIR__ . '/route.php');
    }

    protected function loadFunc()
    {
        include __DIR__ . '/common.php';
    }
}
